'use strict';
module.exports = (sequelize, DataTypes) => {
  const Role = sequelize.define('Role', {
    name: DataTypes.STRING,
    isNobody: {
      type: DataTypes.BOOLEAN,
      defaultValue: false
    },
    isLogined: {
      type: DataTypes.BOOLEAN,
      defaultValue: false,
    },
    owner: {
      type: DataTypes.BOOLEAN,
      defaultValue: false,
    }
  }, {});
  Role.associate = function(models) {
    // associations can be defined here
    Role.belongsTo(models.CorporateEntity);
    Role.belongsToMany(models.User, {through: 'RoleUser'});

  };
  return Role;
};